home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Maths & Calculations / count-to-3000.izs < prev    next >
Text File  |  2005-07-20  |  3KB  |  114 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Count down to year 3000
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>The below script will count down to the year 3000!
  7. <!/DESCRIPTION> 
  8.  
  9. <!CATEGORY>counters<!/CATEGORY>
  10.  
  11. <!SCRIPT>
  12. <!-- START OF SCRIPT -->
  13. <!-- Simply insert the below to the <BODY> section of page:                -->
  14.  
  15. <form name="count">
  16. <input type="text" size="69" name="count2">
  17. </form>
  18.  
  19.  
  20. <script>
  21.  
  22.  
  23.  
  24. //change the text below to reflect your own,
  25. var before="Year 3000!"
  26. var current="Today is Year 3000!"
  27. var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
  28.  
  29. function countdown(yr,m,d){
  30. theyear=yr;themonth=m;theday=d
  31. var today=new Date()
  32. var todayy=today.getYear()
  33. if (todayy < 1000)
  34. todayy+=1900
  35. var todaym=today.getMonth()
  36. var todayd=today.getDate()
  37. var todayh=today.getHours()
  38. var todaymin=today.getMinutes()
  39. var todaysec=today.getSeconds()
  40. var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
  41. futurestring=montharray[m-1]+" "+d+", "+yr
  42. dd=Date.parse(futurestring)-Date.parse(todaystring)
  43. dday=Math.floor(dd/(60*60*1000*24)*1)
  44. dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
  45. dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
  46. dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
  47. if(dday==0&&dhour==0&&dmin==0&&dsec==1){
  48. document.forms.count.count2.value=current
  49. return
  50. }
  51. else
  52. document.forms.count.count2.value=dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+before
  53. setTimeout("countdown(theyear,themonth,theday)",1000)
  54. }
  55. //enter the count down date using the format year/month/day
  56. countdown(3000,1,1)
  57. </script>
  58.  
  59. <!-- END OF SCRIPT -->
  60. <!/SCRIPT>
  61.  
  62. <!PREVIEW>
  63. <!-- START OF SCRIPT -->
  64. <!-- Simply insert the below to the <BODY> section of page:                -->
  65.  
  66. <form name="count">
  67. <input type="text" size="69" name="count2">
  68. </form>
  69.  
  70.  
  71. <script>
  72.  
  73.  
  74.  
  75. //change the text below to reflect your own,
  76. var before="Year 3000!"
  77. var current="Today is Year 3000!"
  78. var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
  79.  
  80. function countdown(yr,m,d){
  81. theyear=yr;themonth=m;theday=d
  82. var today=new Date()
  83. var todayy=today.getYear()
  84. if (todayy < 1000)
  85. todayy+=1900
  86. var todaym=today.getMonth()
  87. var todayd=today.getDate()
  88. var todayh=today.getHours()
  89. var todaymin=today.getMinutes()
  90. var todaysec=today.getSeconds()
  91. var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
  92. futurestring=montharray[m-1]+" "+d+", "+yr
  93. dd=Date.parse(futurestring)-Date.parse(todaystring)
  94. dday=Math.floor(dd/(60*60*1000*24)*1)
  95. dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
  96. dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
  97. dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
  98. if(dday==0&&dhour==0&&dmin==0&&dsec==1){
  99. document.forms.count.count2.value=current
  100. return
  101. }
  102. else
  103. document.forms.count.count2.value=dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+before
  104. setTimeout("countdown(theyear,themonth,theday)",1000)
  105. }
  106. //enter the count down date using the format year/month/day
  107. countdown(3000,1,1)
  108. </script>
  109.  
  110.  
  111. <!-- END OF SCRIPT -->
  112. <!/PREVIEW>
  113.  
  114. <!RELATED>NONE<!/RELATED>